//
//  HotTableViewCell.m
//  rubaoduanzi
//
//  Created by 郝志华 on 16/9/13.
//  Copyright © 2016年 郝志华. All rights reserved.
//

#import "HotTableViewCell.h"
#import "HotModel.h"
#import <UIImageView+WebCache.h>
#import <UIImage+GIF.h>
@interface HotTableViewCell ()
@property(nonatomic,strong)UIImageView *dimage;
//头像
@property(nonatomic,strong)UIImageView *timage;
//昵称
@property(nonatomic,strong)UILabel *Username;
//等级
@property(nonatomic,strong)UIButton *lein;
//段位
@property(nonatomic,strong)UILabel *Duanwei;
//积分
@property(nonatomic,strong)UILabel *jifen;
//财富
@property(nonatomic,strong)UILabel *caifu;
//标题
@property(nonatomic,strong)UILabel *title;
//图片
@property(nonatomic,strong)UIImageView *pic;
@property(nonatomic,strong)UIButton *dizan;
@property(nonatomic,strong)UIButton *cai;
@property(nonatomic,strong)UIButton *pinlun;
@property(nonatomic,strong)UIButton *fenx;
@end
@implementation HotTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.dimage=[[UIImageView alloc]init];
        [self.contentView addSubview:self.dimage];
        self.timage=[[UIImageView alloc]init];
        [self.contentView addSubview:self.timage];
        self.Username=[[UILabel alloc]init];
        [self.contentView addSubview:self.Username];
        self.lein=[[UIButton alloc]init];
        [self.contentView addSubview:self.lein];
        self.Duanwei=[[UILabel alloc]init];
        [self.contentView addSubview:self.Duanwei];
        self.jifen=[[UILabel alloc]init];
        [self.contentView addSubview:self.jifen];
        self.caifu=[[UILabel alloc]init];
        [self.contentView addSubview:self.caifu];
        self.title=[[UILabel alloc]init];
        [self.contentView addSubview:self.title];
        self.pic=[[UIImageView alloc]init];
        [self.contentView addSubview:self.pic];
        self.dizan=[[UIButton alloc]init];
        [self.contentView addSubview:self.dizan];
        self.cai=[[UIButton alloc]init];
        [self.contentView addSubview:self.cai];
        self.pinlun=[[UIButton alloc]init];
        [self.contentView addSubview:self.pinlun];
        self.fenx=[[UIButton alloc]init];
        [self.contentView addSubview:self.fenx];
    }
    return self;
}
- (void)setFrameModel:(FrameModel *)frameModel{
    _frameModel=frameModel;
    HotModel *model=_frameModel.model;
    //置顶
    _dimage.frame=_frameModel.zhidingF;
    //头像
    _timage.frame=_frameModel.touxF;
    [_timage sd_setImageWithURL:[NSURL URLWithString:model.photo]];
    //昵称
    _Username.frame=_frameModel.usernameF;
    _Username.text=model.userName;
    //等级
    _lein.frame=_frameModel.dendjiF;
    [_lein setImage:[UIImage imageNamed:@"list_dj"] forState:UIControlStateNormal];
    [_lein setTitle:[NSString stringWithFormat:@"%@",model.userLevel] forState:UIControlStateNormal];
    [_lein setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    //段位
    _Duanwei.frame=_frameModel.dunweiF;
    _Duanwei.text=[NSString stringWithFormat:@"段位：%@",model.userTitle];
    //积分
    _jifen.frame=_frameModel.jifenF;
    _jifen.text=[NSString stringWithFormat:@"积分：%@",model.integral];
    //财富
    _caifu.frame=_frameModel.caifuF;
    _caifu.text=[NSString stringWithFormat:@"招财币：%@",model.coin];
    //标题
    _title.frame=_frameModel.biaotiF;
    _title.numberOfLines=0;
    _title.text=model.content;
    //图片
    _pic.frame=_frameModel.tupianF;
    _pic.image=[UIImage sd_animatedGIFWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:model.pic]]];
    //点赞
    _dizan.frame=_frameModel.dianzanF;
    [_dizan setImage:[UIImage imageNamed:@"list_zan"] forState:UIControlStateNormal];
    [_dizan setTitle:[NSString stringWithFormat:@"%@",model.up] forState:UIControlStateNormal];
    [_dizan setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [_dizan addTarget:self action:@selector(zan:) forControlEvents:UIControlEventTouchUpInside];
    //踩
    _cai.frame=_frameModel.caiF;
    [_cai setImage:[UIImage imageNamed:@"list_xun"] forState:UIControlStateNormal];
    [_cai setTitle:[NSString stringWithFormat:@"%@",model.down] forState:UIControlStateNormal];
    [_cai setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [_cai addTarget:self action:@selector(cai:) forControlEvents:UIControlEventTouchUpInside];
    //品论
    _pinlun.frame=_frameModel.pinlunF;
    [_pinlun setImage:[UIImage imageNamed:@"list_ly"] forState:UIControlStateNormal];
    [_pinlun addTarget:self action:@selector(pin:) forControlEvents:UIControlEventTouchUpInside];
    //分享
    _fenx.frame=_frameModel.fenxF;
    [_fenx setImage:[UIImage imageNamed:@"list_more"] forState:UIControlStateNormal];
    [_fenx addTarget:self action:@selector(fen:) forControlEvents:UIControlEventTouchUpInside];
}
//点赞按钮的单击事件
- (void)zan:(UIButton *)sender{

    

}
//cai
- (void)cai:(UIButton *)sender{


}
//品论
- (void)pin:(UIButton *)sender{


}
//分享
- (void)fen:(UIButton *)sender{


}
@end
